console.log( "start" );

// tmp = document.createElement("div");
// tmp.id = "outputbox";
// document.body.appendChild(tmp);

url = undefined;

document.addEventListener("dragstart", function(event) {
    //alert("drag");
    if (event.target.tagName == "A") {
        //alert(event.target.href);
        url = event.target.href;
        //event.dataTransfer.setData("Text",event.target.href);
    }
});

document.addEventListener("dragend", function( event ) { 
    if(event.target.tagName == "A") {
        event.preventDefault();
        //url = event.dataTransfer.getData("Text");
        //alert(event.target.href);
        chrome.runtime.sendMessage({greeting: "url", data:url}, function(response) {
            console.log(response.farewell);
        });
    }
});

document.body.id = "test";

$(document).ready(function () {
    $("#test").fancygestures(function (data) {
        // document.getElementById('outputbox').innerHTML += data;
        chrome.runtime.sendMessage({greeting: data}, function(response) {
            console.log(response.farewell);
        });
    });
});

